package ec.edu.cec.java.adv.archivos;

import java.io.File;
import java.io.IOException;
import java.util.Date;

public class SettingFileDate {

	public static void main(String[] args) throws IOException {
		File fileToChange = new File("c:/test/fileDateSetting.txt");
		boolean bool = false;
		bool = fileToChange.createNewFile();
		System.out.println("Se creo el archivo? "+bool);
		printDateFile(fileToChange);
		//
		changeDateFile(fileToChange);
		printDateFile(fileToChange);
	}
	
	public static void printDateFile(File nameFile){
		Date timeFile = new Date(nameFile.lastModified());
		System.out.println(timeFile.toString());	
	}
	
	public static void changeDateFile(File nameFile){
		System.out.println(System.currentTimeMillis());
		nameFile.setLastModified(System.currentTimeMillis());		
	}
}
